//
//  ConnectDeviceViewController.m
//  JunZeWristband
//
//  Created by Kendama on 2017/8/26.
//  Copyright © 2017年 DT. All rights reserved.
//

#import "AddDeviceViewController.h"
#import "SearchDeviceView.h"
#import "SearchFailView.h"

@interface AddDeviceViewController ()

/** 搜索设备页 **/
@property(nonatomic,strong) SearchDeviceView *searchView;
@property(nonatomic,strong) SearchFailView *failView;

@end

@implementation AddDeviceViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

- (void)dealloc
{
    
}

- (void)refreshBaseControlValue
{
    
}

#pragma mark - 点击事件
- (void)didClickAgainSearchButton
{
    [self.view bringSubviewToFront:self.searchView];
    [[DTCBluetoothManager shareInstance] scanAroundDevice];//自主控制设备扫描操作

}

#pragma mark - 事件处理

#pragma mark - 代理


#pragma mark - 通知处理

#pragma mark - 懒加载
- (SearchDeviceView *)searchView
{
    if(!_searchView)
    {
        UIView *superView = self.view;
        _searchView = [[SearchDeviceView alloc]init];
        [superView addSubview:_searchView];
    }
    return _searchView;
}

- (SearchFailView *)failView
{
    if(!_failView)
    {
        UIView *superView = self.view;
        _failView = [[SearchFailView alloc]init];
        [superView addSubview:_failView];
        [_failView.searchButton addTarget:self action:@selector(didClickAgainSearchButton) forControlEvents:UIControlEventTouchUpInside];
    }
    return _failView;
}



#pragma mark - 初始化
- (void)setNavigationStyle
{
    
}

- (void)masLayoutSubview
{
    __weak UIView *superView = self.view;
    [self.searchView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(superView.mas_top).with.offset(64);
        make.left.right.bottom.mas_equalTo(superView);
    }];
    
    [self.searchView startAnimation];
    
    [self.failView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(superView.mas_top).with.offset(64);
        make.left.right.bottom.mas_equalTo(superView);
    }];
}

@end
